<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp" %>
<!DOCTYPE html>
<html>
<head>
	<title><spring:message code="message.jieSuan.jiaoKuanTongZhiShu"/><spring:message code="message.jqGrid.cz.xiangQing"/></title>
	<%@ include file="/WEB-INF/component/commonCSS.jsp"%>
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1><spring:message code="message.jieSuan.jiaoKuanTongZhiShu"/><spring:message code="message.jqGrid.cz.xiangQing"/></h1>
        <ol class="breadcrumb">
            <li><a href="${ctx }/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first"/></a></li>
           <li class="active"><spring:message code="message.jieSuan.jiaoKuanDanGuanLi"/></li>
            <li class="active"><spring:message code="message.jieSuan.jiaoKuanTongZhiShu"/></li>
        </ol>
    </section>
    
    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
            <form id="form">
                <div class="input">
                	<div class="textalign1"><spring:message code="message.listForm.tongYongMing"/><spring:message code="message.yanZheng.maoHao"/></div>
                        <div class="boxinput">
                        <input type="text" class="textinput" id="drugName" name="drugName" placeholder="<spring:message code="message.listForm.tongYongMing"/>" maxlength="200" />
                    </div>
                   	<div class="textalign1"><spring:message code="message.listForm.yaoPinBianMa"/><spring:message code="message.yanZheng.maoHao"/></div>
                        <div class="boxinput">
                        <input type="text" class="textinput" id="drugCode" name="drugCode" placeholder="<spring:message code="message.listForm.yaoPinBianMa"/>"  maxlength="100" />
                    	</div>
                	<div class="textalign1"><spring:message code="message.jieSuan.jieSuanLeiXing"/><spring:message code="message.yanZheng.maoHao"/></div>
                        	<div class="boxinput">
                        	<select class="textinput"  id="bankAcctTransType" name="bankAcctTransType" >
	                 		  	<option  value=""><spring:message code="message.select.option"/></option>
	                 		  	<option  value="1"><spring:message code="message.jieSuan.caiGouDan"/></option>
	                 		  	<option  value="2"><spring:message code="message.jieSuan.tuiHuoDan"/></option>
	                 		</select>
                    		</div>
                    <div class="textalign1" >
                    <button type="button" class="btn btn-success btn-sm" onclick="gridSerch();" id="selectDicCompType"><spring:message code="message.button.seachSpacing"/></button>
                </div>
                </div>
                </form>
            </div>
        </div>
        
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
                  <div class=" box box-warning bottongroup">
                    <a href="javascript:history.go(-1)" class="btn btn-default btn-sm"><spring:message code="message.button.getBackSpacing"/></a>
                </div>
    </section>

		<%@ include file="/WEB-INF/component/commonJS.jsp"%>
		<script type="text/javascript">
		   //绑定回车
		   $('#drugName,#drugCode,#bankAcctTransType').bind('keydown', function(event) { 
		       if (event.keyCode == "13") {
		           $('#selectDicCompType').click();
		       }
		   });	
		   $("#drugName").focus();//加载页面光标在第一个查询框内
		
		
		$(function () {
			jQuery("#gridlist").jqGrid({
    			url: "${ctx}/setPaynotice/getSetPaynoticeDetailList.html?noticeId=${param.noticeId}",
    		    mtype: "POST",
    			datatype: "json",
    			autowidth: true,
    			shrinkToFit: false,
    			height: 300,
    		   	colNames:['',
    		   	          '<spring:message code="message.jieSuan.jieSuanLeiXing"/>',
    		   	          '<spring:message code="message.jieSuan.caiGouJia"/>',
    		   	          '<spring:message code="message.jieSuan.jieSuanShuLiang"/>',
    		   	          '<spring:message code="message.listForm.yaoPinBianMa"/>',
    		   	          '<spring:message code="message.listForm.tongYongMing"/>',
    		   	          '<spring:message code="message.listForm.jiXing"/>',
    		   	          '<spring:message code="message.listForm.guiGe"/>',
    		   	          '<spring:message code="message.listForm.zhuanHuanXiShu"/>',
    		   	          '<spring:message code="message.listForm.baoZhuangDanWei"/>',
    		   	          '<spring:message code="message.listForm.caiZhi"/>',
    		   	          '<spring:message code="message.listForm.shengChanQiYe"/>',
    		   	          '<spring:message code="message.model.peiSongQiYe"/>'
    		   	          ],
    		   	colModel:[
					   { name: 'drugId', width: 120 ,hidden:true, align:"center" ,sortable: false},
    		   	       {name:'bankAcctTransType',index:'prodCompId', width:80, align:"center",sortable: false,
    		   	    	formatter:function(cellvalue, options, row){
    		   	    		var temp = "<spring:message code="message.listForm.qiTa"/>";
    		   	    		if(cellvalue==1){temp = '<spring:message code="message.jieSuan.caiGouDan"/>';}
    		   	    		else if(cellvalue==2){temp = '<spring:message code="message.jieSuan.tuiHuoDan"/>';}
							return temp;
						}
    		   	       },
    		   	   	   { name: 'proPrice', width: 80 , align:"right" ,sortable: false,
    		   	    	formatter:function(cellvalue, options, row){
							return formatAmount(cellvalue, options, row);
						}
    		   	       },
    		   	       { name: 'recpCount', width: 80 , align:"center" ,sortable: false,
	    		   	   		formatter:function(cellvalue, options, row){
								return cellvalue==null?0:cellvalue;
							}
    		   	   	   },
    		   	       { name: 'drugCode', width: 100 , align:"left" ,sortable: false,
						formatter:function(cellvalue, options, row) {
							return "<a href=\"javascript:$.HN.dialog.opendialog('"+row.drugId+"','<spring:message code="message.lable.proddruginfoSTDdetail"/>','${ctx}/stdDrug/drugInfoDetail.html?drugId="+row.drugId+"','800px','400px',function operResult(val){return operResult;})\">"+cellvalue+"</a>"
                    	}},
    		   	       { name: 'drugName', width: 140 , align:"left" ,sortable: false},
                       { name: 'formName', width: 80 , align:"center" ,sortable: false},
                       { name: 'specName', width: 80 , align:"left" ,sortable: false},
                       { name: 'factor', width: 80, align:"center" ,sortable: false},
                       { name: 'unit', width: 40 , align:"center" ,sortable: false},
                       { name: 'materialName', width: 80 , align:"center" ,sortable: false},
                       { name: 'prodComp', width: 190 , align:"left" ,sortable: false,
                           formatter:function(cellvalue, options, row){
                               return '<a href="javascript:showCompInfo(\''+ row.prodCompId +'\');">'+cellvalue+'</a>';
                           }},
                       { name: 'compName', width: 180 , align:"left",sortable:false,
						 formatter:function(cellvalue, options,row) {
							 return "<a href=\"javascript:$.HN.dialog.opendialog('"+row.compId+"','"+cellvalue+"','${ctx}/stdCompinfo/toStdCompinfoDetail.html?compId="+row.compId+"','800px','400px',function operResult(val){return operResult;})\">"+cellvalue+"</a>";
			     		} }
                       
    		   	],
    			 rowNum: 20,
    		     rowList: [10, 20, 50, 100],
    		     rownumbers: true,
    		     pager: "#gridpage",
    		     viewrecords: true,
    		     gridComplete: function(){
      	        	 //序号列宽度自适应（参数为jqgridID）
      	               autoRNWidth("gridlist");
      	           	//数据只有一条时默认选中（参数为jqgridID）
      	               selectByOneData("gridlist");
      			},
    		     caption: "<spring:message code="message.jieSuan.jiaoKuanTongZhiShu"/><spring:message code="message.jqGrid.cz.xiangQing"/><spring:message code="message.listForm.lieBiao"/>",
    		     jsonReader: {
    		         repeatitems: false,
    		         id: "ids"
    		     }
    		});
            
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            
            $(window).trigger("resize");
            
        });
			
	
		//查询
        function gridSerch() {
        	var data = formatForm("form");
    		$("#gridlist").jqGrid('setGridParam',{  
    	        datatype:'json',
    	        postData:data,
    	        		page:1
    	    }).trigger("reloadGrid"); //重新载入  
    	}
        //生产企业信息弹窗
        function showCompInfo(prodCompId) {
            $.HN.dialog.open({
                "id": "showCompInfo", 
                "title": "<spring:message code="message.listForm.shengChanQiYe"/><spring:message code="message.listForm.xinXi"/>", 
                "url": "${ctx}/stdCompinfo/toStdCompinfoDetail.html?compId="+prodCompId,
                "data": {}, 
                "width": 800, 
                "height": 400, 
                "closefunc":function() {
                    
                }
            });
        }
        
   	 //回调
		 function operResult(val){
	        	var strs = new Array();
	            strs = val.split("|$");
	      
	            	if (val.length>0) {
						$('#'+strs[0]).val(strs[2]);
					}
					if (val.length>0) {
						$('#'+strs[1]).html(strs[3]);
					}
	        }
			 
</script>
</body>
</html>